package com.hermes.action.json;

import com.hermes.biz.common.model.result.UserResultDO;
import com.hermes.biz.common.util.json.JsonDataParserUtil;
import com.hermes.biz.common.util.string.StringUtil;
import com.hermes.biz.service.user.UserService;
import com.hermes.common.action.AsynBaseAction;
import com.hermes.common.util.ParameterParserUtil;

public class AsynGetSingleUserInfo extends AsynBaseAction {

    /**
     * 
     */
    private static final long serialVersionUID = -269371048172227848L;

    private UserService       userService;

    private String            constent;

    @Override
    public String execute() {

        String userIdStr = ParameterParserUtil.getParameter("userId");

        long userId = 0;

        if (StringUtil.isNumOnly(userIdStr)) {
            userId = Long.parseLong(userIdStr);
        }

        UserResultDO userResultDO = userService.getUserInfoByUserId(userId);

        setConstent(JsonDataParserUtil.parse(userResultDO));

        return SUCCESS;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public String getConstent() {
        return constent;
    }

    public void setConstent(String constent) {
        this.constent = constent;
    }

}
